﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AccountingClient.AccountingServer
{
    partial class TransactionItem : System.ComponentModel.IEditableObject
    {
        private bool isEditing = false;
        private int backupAccountId;
        private bool backupIsCredit;
        private decimal backupAmount;
        public void BeginEdit()
        {
            isEditing = true;
            backupAccountId = AccountId;
            backupAmount = Amount;
            backupIsCredit = IsCredit;
        }

        public void CancelEdit()
        {
            if (isEditing)
            {
                AccountId = backupAccountId;
                Amount = backupAmount;
                IsCredit = backupIsCredit;
                isEditing = false;
            }
        }

        public void EndEdit()
        {
            if (isEditing)
            {
                backupAccountId = AccountId;
                backupAmount = Amount;
                backupIsCredit = IsCredit;
                isEditing = false;
            }
        }
    }
}
